<?php

function set2session($info,$step) {
    switch ($step) {
        case 1:
            personal2session($info);
            break;
        case 2:
            study2session($info);
            break;
        case 3:
            languages2session($info);
            break;
        case 4:
            period2session($info);
            break;
        case 5:
            files2session($info);
            break;
        case 6:
        	break;
    }
}

function personal2session($info) {
    $tmp = Array();
    $tmp['firstname'] = $_POST['firstname'];
    $tmp['lastname'] = $_POST['lastname'];
    $tmp['bornDay'] = $_POST['bornday'];
    $tmp['bornMonth'] = $_POST['bornmonth'];
    $tmp['bornYear'] = $_POST['bornyear'];
    $tmp['sex'] = $_POST['sex'];
    $tmp['maritalstatus'] = $_POST['maritalstatus'];
    $tmp['medicallyfit'] = $_POST['medicallyfit'];
    $tmp['medicalstatus'] = $_POST['medicalstatus'];
    $tmp['termAddr1'] = $_POST['termAddr1'];
    $tmp['termAddr2'] = $_POST['termAddr2'];
    $tmp['termPostalCode'] = $_POST['termPostalCode'];
    $tmp['mobilephone'] = $_POST['mobilephone'];
    $tmp['homeAddr1'] = $_POST['homeAddr1'];
    $tmp['homeAddr2'] = $_POST['homeAddr2'];
    $tmp['homePostalCode'] = $_POST['homePostalCode'];
    $tmp['privatePhone'] = $_POST['homephone'];
    $tmp['nationality'] = $_POST['nationality'];
    $_SESSION['personal'] = $tmp;
    unset($tmp);
}

function study2session($info) {
    $tmp = Array();
    $tmp['university'] = $_POST['university'];
    $tmp['fieldofstudy'] = $_POST['fieldofstudy'];
    $tmp['specialization'] = $_POST['specialization'];
    $tmp['pointsreq'] = $_POST['pointsreq'];
    $tmp['pointsattained'] = $_POST['pointsattained'];
    $tmp['yearsreq'] = $_POST['yearsreq'];
    $_SESSION['study'] = $tmp;
    unset($tmp);
}

function languages2session($info) {
    $tmp = Array();
    $tmp['language1'] = $_POST['language1'];
    $tmp['skill1'] = $_POST['skill1'];
    $_SESSION['languages'] = $tmp;
    unset($tmp);
}

function period2session($info) {
    $tmp = Array();
    $tmp['fromDay'] = $_POST['fromDay'];
    $tmp['fromMonth'] = $_POST['fromMonth'];
    $tmp['fromYear'] = $_POST['fromYear'];
    $tmp['untilDay'] = $_POST['untilDay'];
    $tmp['untilMonth'] = $_POST['untilMonth'];
    $tmp['untilYear'] = $_POST['untilYear'];
    $tmp['min'] = $_POST['min'];
    $tmp['max'] = $_POST['max'];
    $tmp['appliedbefore'] = $_POST['appliedbefore'];
    $_SESSION['period'] = $tmp;
    unset($tmp);
}

function files2session($info) {
	require_once('files.php');
	if(checkExchangeYearFolder()) {
	} else {
		createExchangeYearFolder();
	}
	if(checkUserFolder('teis')) {}
	else {
		createUserFolder('teis');
	}
	print_r($_POST);
	//uploadUserFile('teis','cv');
}
?>
